package com.neusoft.yuejian_6.activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.neusoft.yuejian_6.R;
import com.squareup.picasso.Picasso;

import java.util.List;

import static com.neusoft.yuejian_6.base.Constant.CLUB_PHOTO_URL;

public class ClubInfoActivity extends Activity {



    private ImageView collect;
    private ImageView c_pic;
    private TextView c_name;
    private TextView c_address;
  private  TextView  c_time;
    private TextView c_intro;
    private TextView c_phone;
    private int club_id;
    private int flag;
    private String clubname;
    private  String clubphone;

    private Button cluInforadio,activityradio,classradio,videoradio;
    private Context mContex;
    private List mDataList;
    private LayoutInflater mLayoutInflater;
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        setContentView(R.layout.activity_club_info);
        initView();
        getClubData();
        initEvent();

        // isBeCollected();
    }


    private void initView() {

        //collect = (ImageView) findViewById(R.id.collect);

        c_name = (TextView) findViewById(R.id.club_name);
        c_address = (TextView) findViewById(R.id.club_address);
          c_time=(TextView)findViewById(R.id.club_time);
        c_intro = (TextView) findViewById(R.id.club_intro);
        c_phone = (TextView) findViewById(R.id.club_phone);
        c_pic = (ImageView) findViewById(R.id.club_pic);

        cluInforadio = (Button) findViewById(R.id.cluInforadio);
        classradio = (Button) findViewById(R.id.classradio);
        videoradio = (Button) findViewById(R.id.videoradio);
        activityradio=(Button)findViewById(R.id.activityradio);

    }

    private void initEvent(){
        final Bundle bundle = this.getIntent().getExtras();
        final int club_id=bundle.getInt("club_id");




//        cluInforadio.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//                Intent intent = new Intent(ClubInfoActivity.this,ClubInfoActivity.class);
//                Bundle bundle = new Bundle();
//                bundle.putInt("club_id", club_id);
//                intent.putExtras(bundle);
//                startActivity(intent);
//            }
//        });
        classradio.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(ClubInfoActivity.this,ClassActivity.class);
                Bundle bundle = new Bundle();
                bundle.putInt("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
        activityradio.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(ClubInfoActivity.this,ClubAllActivityActivity.class);
                Bundle bundle = new Bundle();
                bundle.putInt("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

        videoradio.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ClubInfoActivity.this,VideosActivity.class);
                Bundle bundle = new Bundle();
                bundle.putInt("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

    }
    private void getClubData() {
        Bundle bundle = this.getIntent().getExtras();
        final int club_id=bundle.getInt("club_id");

        String clubname = bundle.getString("club_name");
        System.out.print(clubname);
        String clubaddress = bundle.getString("club_address");
        String clubphone = bundle.getString("club_phone");
        String clubintro = bundle.getString("club_intro");
        String clubtime=bundle.getString("club_time");
        // int tprice = bundle.getInt("t_price");
        String clubpic = CLUB_PHOTO_URL + bundle.getString("club_pic");

        c_name.setText(clubname);
        c_address.setText(clubaddress);
        c_phone.setText(clubphone);
        c_intro.setText(clubintro);
         c_time.setText(clubtime);
        Picasso.with(this).load(clubpic).into(c_pic);
        classradio.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ClubInfoActivity.this,ClassActivity.class);
                Bundle bundle = new Bundle();
                bundle.putInt("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

        }
        }